package com.is.add.controller.restful;

import com.is.add.controller.vo.RankingDataVO;
import com.is.add.controller.vo.ServerGroupStatusVO;
import com.is.add.service.MonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 监控系统信息
 * Created by jackie on 2016/8/9.
 */
@RestController
@RequestMapping("api/monitor")
@CrossOrigin
public class MonitorController {

    @Autowired
    private MonitorService monitorService;

    /**
     * 监控服务器状态
     * @param sign                  请求识别码
     * @return                      ServerStatusVO
     */
    @RequestMapping("/serverStatus")
    public ServerGroupStatusVO monitorServerStatus(@RequestParam String sign) {
        return this.monitorService.monitorServer(sign);
    }

    /**
     * 日统计排行榜数据
     * @param sign              识别码
     * @return                  RankingDataVO
     */
    @RequestMapping("/rankingList")
    public RankingDataVO rankingData(@RequestParam String sign) {
        return this.monitorService.dayCountRankingData(sign);
    }

}
